#ifndef LAYOUT_H_
#define LAYOUT_H_
#include "IWindow.h"
#include "def.h"

enum LAYOUT_TYPE{
    VERT,
    HORIZ
};

class Layout : public IWindow {
    public:
        Layout();
        virtual ~Layout();
        //Print actual data of the buffer on the window
        virtual int Display(int focus);
        //Updates screen buffer
        virtual void Update();
        //Does actual paint on screen
        virtual void Clean();
        virtual void AddWindow(IWindow* win);
        virtual void RemoveWindow(IWindow* win);
        virtual void Locate(int y, int x, int h, int w);
        virtual void Resize_LT(int x, int y);
        virtual void Resize_RB(int x, int y);
        virtual void Paint();
        virtual void Move(int x, int y);
        virtual bool IsEnabled();
        virtual void Enable();
        virtual void Disable();
        virtual void Shift(int len);
        virtual int GetMinH();
        virtual int GetMinW();
        virtual void Top();
        virtual void UpdateLayout();
    protected:
        IWindow* m_sub_wins[2];
        unsigned int m_nWins;
        double m_split_bar;
        LAYOUT_TYPE m_type;
};

class VLayout : public Layout {
    public:
        VLayout()
        {
            m_type = VERT;
            m_split_bar = 0.5;
        }
};

class HLayout : public Layout {
    public:
        HLayout()
        {
            m_type = HORIZ;
            m_split_bar = 0.5;
        }
};

#endif //LAYOUT_H_
